@extends('store::layout')
@push('styles')
    <link href="{{asset(config('store.theme.theme2').'/vendor/bootstrap/dataTables.bootstrap4.min.css')}}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
    <div class="row">
        <div class="col-12">
            @component('store::component.table.table_tpl')
                @slot('page_title'){{$page_title}}@endslot
                @slot('tool_l_btn')
                @endslot
                @if($list->isNotEmpty())
                    @slot('table')
                        <table class="list table table-bordered table-striped">
                            <thead><tr role="row">
                                <td>
                                    @component('store::component.checkbox')
                                        @slot('name') ids-all @endslot
                                    @endcomponent
                                </td>
                                <th>订单号</th><th>用户账号</th> <th>订单金额</th>
                               <th>支付方式</th><th>下单时间</th>
                                <th>订单状态</th><th>操作</th>
                            </tr></thead>
                            <tbody>
                            @foreach($list as $item)
                                <tr role="row" class="odd">
                                    <td>
                                        @component('store::component.checkbox')
                                            @slot('name') order_id[] @endslot
                                            @slot('class') id @endslot
                                            @slot('value') {{$item->order_id}} @endslot
                                        @endcomponent
                                    </td>
                                    <td>{{$item->order_sn}}</td>
                                    <td>{{$item->user->user_number}}</td>
                                    <td>
                                        支付:{{$item->pay_price}}<br/>
                                        积分:{{$item->pay_xf_points ??0}}
                                    </td>
                                    <td>{{config('shop.pay_type')[$item->pay_type]}}</td>
                                    <td>{{$item->created_at}}</td>
                                    <td>{{config('shop.order_status')[$item->status]}}</td>
                                    <td>
                                        @if($item->status==0)
                                            @component('store::component.form.button')
                                                @slot('title') 关闭 @endslot
                                                @slot('size') md @endslot
                                                @slot('color') danger @endslot
                                                @slot('icon') hcl-status-error @endslot
                                                @slot('class') btn-ajax @endslot
                                                @slot('params') {"url":"{{route('Store_Order_closeOrder',['order_id'=>$item->order_id])}}","confirm":true} @endslot
                                            @endcomponent
                                        @elseif($item->status == 1)
                                            @component('store::component.form.button')
                                                @slot('title') 发货 @endslot
                                                @slot('elem') a @endslot
                                                @slot('size') md @endslot
                                                @slot('color') success @endslot
                                                @slot('class') modal-box @endslot
                                                @slot('params') {"area":"600px,350px","title":"确认发货"} @endslot
                                                @slot('icon') hcl-status-cg @endslot
                                                @slot('href') {{route('Store_Order_send',['order_id'=>$item->order_id])}} @endslot
                                            @endcomponent
                                        @endif
                                        @component('store::component.form.button-group')
                                            @slot('button_title')
                                                @component('store::component.form.button')
                                                    @slot('title') 更多 @endslot
                                                    @slot('size') md @endslot
                                                     @slot('icon') hcl-more @endslot
                                                    @slot('class') dropdown-toggle @endslot
                                                    @slot('attr') data-toggle=dropdown @endslot
                                                @endcomponent
                                            @endslot
                                            @slot('button_item')
                                                    @component('store::component.a')
                                                        @slot('title') 订单详情 @endslot
                                                        @slot('class') dropdown-item @endslot
                                                        @slot('href') {{route('Store_Order_detail',['order_id'=>$item->order_id])}} @endslot
                                                    @endcomponent
                                            @endslot
                                        @endcomponent
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    @endslot
                    @slot('page')
                        {{$list->links('store::public.pagination')}}
                    @endslot
                @else
                    @slot('table')
                        @component('store::public.empty')
                            @slot('info') 暂时没有订单 @endslot
                        @endcomponent
                    @endslot
                @endif
            @endcomponent
        </div> <!-- end col -->
    </div>
@endsection

@push('scripts')
    <script src="{{asset(config('store.plugin').'/layui/check-all.js')}}"></script>
@endpush